package net.lzzy.demomybatis.service;

import net.lzzy.demomybatis.entity.Comment;
import net.lzzy.demomybatis.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService {

    @Autowired
    CommentMapper commentMapper;

    public int addComment(Comment comment){
        return commentMapper.addComment(comment);
    }

    public int deleteCommentById(int id) {
        return commentMapper.deleteCommentById(id);
    }

    public int updateCommentById(Comment comment) {
        return commentMapper.updateCommentById(comment);
    }

    public List<Comment> getAllComments() {
        return commentMapper.getAllComments();
    }

    public Comment getCommentById(int id) {
        return commentMapper.findById(id);
    }
}
